load("E/Rclass/diabets.RData")
#20211015yanghuihui#
#方法一
nrow(diabets[which(diabets$GLU>3.9 & diabets$GLU <6.1 & diabets$Sex=="Female"),])

#方法二
k=0
i=1
while (i <= nrow(diabets)) {
  a=diabets[i,]
  if (a[1,1]=="Female" & a[1,2]>3.9 & a[1,2]<6.1) {
    k=k+1
  }
  i=i+1
}
print(k)

#方法三
j=0
for (i in 1:nrow(diabets)) {
  x=diabets[i,]
  if (x[1,1]=="Female" & x[1,2]>3.9 & x[1,2]<6.1) {
    j=j+1
  }
}
print(j)
